package com.itfitness.workmanagerdemo;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

/**
 * @ProjectName: WorkManagerDemo
 * @Package: com.itfitness.workmanagerdemo
 * @ClassName: TransferDataWork
 * @Description: java类作用描述
 * @Author: itfitness
 * @CreateDate: 2021/9/24 15:24
 * @UpdateUser: 更新者：
 * @UpdateDate: 2021/9/24 15:24
 * @UpdateRemark: 更新说明：
 */
public class TransferDataWork extends Worker {
    public TransferDataWork(@NonNull Context context, @NonNull WorkerParameters workerParams) {
        super(context, workerParams);
    }

    @NonNull
    @Override
    public Result doWork() {
        String activityData = getInputData().getString("data");
        Log.e("传递数据任务",activityData);
        Data data = new Data.Builder()
                .putString("data","TransferDataWork的数据").build();
        return Result.success(data);
    }
}
